package com.photoeditor.demo.ui.widget.image;

/**
 * 类似与一个队列
 */
public class TileBitmapQueue {
    private TileImageView.TileBitmap mHead;

    public TileImageView.TileBitmap pop() {
        TileImageView.TileBitmap tile = mHead;
        if (tile != null) mHead = tile.mNext;
        return tile;
    }

    public boolean push(TileImageView.TileBitmap tile) {
        boolean wasEmpty = mHead == null;
        tile.mNext = mHead;
        mHead = tile;
        return wasEmpty;
    }

    public void clean() {
        mHead = null;
    }

    public boolean isEmpty() {
        return mHead == null;
    }
}
